package com.stockz.equity.charting.view.widget;

import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;

public class JProgressBarUpdator implements Runnable{

	private static JProgressBarUpdator progressBarUpdator = new JProgressBarUpdator();
	
	public static void update(JProgressBar progressBar, int progress){
		progressBarUpdator.setProgressBar(progressBar);
		progressBarUpdator.setProgress(progress);
		SwingUtilities.invokeLater(progressBarUpdator);
	}
	

	private JProgressBar progressBar;
	private int progress;

	private JProgressBarUpdator(){}
	
	@Override
	public void run() {
		progressBar.setValue(progress);
	}

	public JProgressBar getProgressBar() {
		return progressBar;
	}

	public void setProgressBar(JProgressBar progressBar) {
		this.progressBar = progressBar;
	}

	public int getProgress() {
		return progress;
	}

	public void setProgress(int progress) {
		this.progress = progress;
	}

}
